package com.szy.redstonemcu;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;

public class ResetButton extends GuiButton {

    public McuBaseEntity te;

    public ResetButton(int buttonId, int x, int y, String buttonText, McuBaseEntity te) {
        super(buttonId, x, y, buttonText);
        this.te=te;
    }

    public ResetButton(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, McuBaseEntity te) {
        super(buttonId, x, y, widthIn, heightIn, buttonText);
        this.te=te;
    }

    @Override
    public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
        if(mouseX > x && mouseX < x + width && mouseY > y && mouseY < y + height){
            RedstoneMCU.simpleNetworkWrapper.sendToServer(new McuMessage(te.getPos(), McuMessage.TYPE_RESET_RUN));
        }
        return super.mousePressed(mc, mouseX, mouseY);
    }
}
